package com.db.cm.app.service.impl;

import com.db.cm.app.model.StockDO;
import com.db.cm.app.mapper.StockMapper;
import com.db.cm.app.service.StockService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author YOURSLIHUA
 * @since 2023-11-24
 */
@Service
public class StockServiceImpl extends ServiceImpl<StockMapper, StockDO> implements StockService {

    @Autowired
    StockMapper stockMapper;

    @Override
    public List<StockDO> selectAll() {
        return stockMapper.selectList(null);
    }

    @Override
    public StockDO selectById(String stockId) {
        return stockMapper.selectById(stockId);
    }

    @Override
    public boolean update(StockDO entity) {
        return stockMapper.updateById(entity) > 0;
    }

    @Override
    public boolean add(StockDO entity) {
        return stockMapper.insert(entity) > 0;
    }

    @Override
    public boolean delete(StockDO entity) {
        return stockMapper.deleteById(entity) > 0;
    }
}
